import http from "../request";
const apibase = "/api/JobGroup";

//获取工作集
var getJobGroupDtos = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetJobGroups`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除工作集
var deleteJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DeleteJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//新增工作集
var addJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/AddJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//修改工作集
var updateJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdateJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//复制工作集
var copyJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/CopyJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//审核工作集
var verifyJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/VerifyJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//反审核工作集
var oppositeVerifyJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/OppositeVerifyJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//批准
var ratifyJobGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/RatifyJobGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export {
  getJobGroupDtos,
  deleteJobGroup,
  updateJobGroup,
  addJobGroup,
  verifyJobGroup,
  oppositeVerifyJobGroup,
  copyJobGroup,
  ratifyJobGroup
};
